﻿using System;
using AMS.DataAccess.Trademark.BO.Enums;
using AMS.DataAccess.BO;
using System.Collections.Generic;

namespace AMS.DataAccess.Trademark.BO
{
    [DBTable("TT_CaseBasicInfo")]
    public class CaseBasicInfo
    {
        #region Database Column Fields
        [DBPrimaryKeyColumn("AID", true)]
        public int AID { get; set; }

        [DBColumn("CaseIndex")]
        public string CaseIndex { get; set; }

        [DBColumn("CaseName")]
        public string CaseName { get; set; }

        [DBColumn("OwnerID", 0)]
        public int OwnerID { get; set; }

        [DBColumn("CustomerID", 0)]
        public int CustomerID { get; set; }

        [DBEnumColumn("CaseType", typeof(TrademarkCaseType))]
        public TrademarkCaseType CaseType { get; set; }

        [DBEnumColumn("CaseStatus", typeof(TMCaseStatus))]
        public TMCaseStatus CaseStatus { get; set; }

        [DBColumn("RFID", 0)]
        public int RFID { get; set; }

        [DBColumn("CusCaseIndex")]
        public string CusCaseIndex { get; set; }

        [DBColumn("CusLawyer")]
        public string CusLawyer { get; set; }

        [DBColumn("CusWorkLawyer")]
        public string CusWorkLawyer { get; set; }

        [DBColumn("AttachFileCount")]
        public int AttachFileCount { get; set; }

        [DBDateTime("RecvInstructFileDateTime", DateTimeType.DateTime, false, false)]
        public DateTime RecvInstructFileDateTime { get; set; }

        [DBDateTime("CusExpectSubmitDate", DateTimeType.Date, false, false)]
        public DateTime CusExpectSubmitDate { get; set; }

        [DBDateTime("ExpectSubmitDate", DateTimeType.Date, false, false)]
        public DateTime ExpectSubmitDate { get; set; }

        [DBColumn("AuthorizeLetterCount")]
        public int AuthorizeLetterCount { get; set; }

        [DBDateTime("AuthorizeDate", DateTimeType.Date, false, false)]
        public DateTime AuthorizeDate { get; set; }

        [DBColumn("isHastenAuthorizeLetter")]
        public bool isHastenAuthorizeLetter { get; set; }

        [DBColumn("unionAuthorizeLetter")]
        public string unionAuthorizeLetter { get; set; }

        [DBColumn("KeepValid")]
        public bool KeepValid { get; set; }

        [DBColumn("TrademarkID", 0)]
        public int TrademarkID { get; set; }

        [DBColumn("TrademarkRefID", 0)]
        public int TrademarkRefID { get; set; }

        [DBColumn("ApplyIndex")]
        public string ApplyIndex { get; set; }

        [DBDateTime("ApplyDate", DateTimeType.Date, false, false)]
        public DateTime ApplyDate { get; set; }

        [DBColumn("Attorney", 0)]
        public int Attorney { get; set; }

        [DBColumn("Attorney2", 0)]
        public int Attorney2 { get; set; }

        [DBColumn("CaseNote")]
        public string CaseNote { get; set; }

        [DBColumn("SpecialNeeds")]
        public string SpecialNeeds { get; set; }

        [DBColumn("IsFirstEdit")]
        public bool IsFirstEdit { get; set; }

        [DBDateTime("CreateDateTime", DateTimeType.DateTime, false, true)]
        public DateTime CreateDateTime { get; set; }

        [DBColumn("CreateUserID", 0, false, true)]
        public int CreateUserID { get; set; }

        [DBColumn("ModifiedUserID", 0, true, false)]
        public int ModifiedUserID { get; set; }

        [DBDateTime("ModifiedDateTime", DateTimeType.DateTime, true, false)]
        public DateTime ModifiedDateTime { get; set; }

        [DBVersionColumn("Version")]
        public int Version { get; set; }

        [DBVersionColumn("VersionDateTime")]
        public DateTime VersionDateTime { get; set; }

        [DBColumn("VersionUser", 0)]
        public int VersionUser { get; set; }
        #endregion

        public TrademarkInfo Trademark { get; set; }
        public CustomerInfo Customer { get; set; }
        public CustomerInfo Applicant { get; set; }
        public List<CustomerInfo> OtherApplicants { get; set; }
        public ContactorInfo Contactor { get; set; }
        public List<ContactorInfo> OtherContactors { get; set; }

        public void AddOtherApplicant(CustomerInfo applicant)
        {
            if (OtherApplicants == null)
            {
                OtherApplicants = new List<CustomerInfo>();
            }

            OtherApplicants.Add(applicant);
        }

        public void AddOtherContactors(ContactorInfo contactor)
        {
            if (OtherContactors == null)
            {
                OtherContactors = new List<ContactorInfo>();
            }

            OtherContactors.Add(contactor);
        }
    }
}
